<!DOCTYPE html>
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<html>
   <title><?php echo $title;?></title>
   <link href="<?php echo base_url();?>asset/admin/css/style.css" rel="stylesheet" type="text/css" />
<body>
   <div id="header"><h2>APLIKASI EPROC PTPN 4</h2></div>
   <div id="content">
      <?php
      // tampilkan sidebar menu HANYA apabila user telah login
      if($this->auth->is_logged_in() == true):
      //-------------------------------------
      //  PINDAHAN DARI VIEW INDEX.PHP
      //-------------------------------------
      // level untuk user ini
      $level = $this->session->userdata('level');
      // ambil menu dari database sesuai dengan level
      $menu = $this->usermodel->get_menu_for_level($level);
      ?>
      <div id="header-bar">
         Sesi aktif user : <?php echo $this->session->userdata('nama');?>, 
         <?php echo anchor('eproc/logout','Logout');?>
      </div>
      <div id="sidebar-menu">
         <ul class="menu">
            <?php
            foreach($menu->result() as $row)
            {
               echo '<li>'.anchor($row->menu_uri,$row->menu_nama).'</li>';
            }
            ?>
         </ul>
      </div>
      <?php
      //--------------------------------------
      //    END PINDAHAN
      //--------------------------------------
      endif;
      ?>
       
      <?php
         // dynamic content loaded here
         echo $contents;
      ?>
       
      <div class="clear"></div>
   </div>
   <div id="footer">Copyright &copy; MSI PTPN 4 Medan</div>
</body>
</html>